/** @jsxImportSource @emotion/react */
import * as React from "react";
import {CCell, Cell, Table, TableBody, TableRow, Text, useTheme,} from "customize-easy-ui-component";
import {RepLink, ReportViewProps,} from "../../common/base";
import {末尾链接, 落款单位地址,} from "../../common/rarelyVary";
import {检验报告设备,} from "./viewRes";
import {useRepMenuDirItems} from "../../hook/useMainRepUrlOr";
import {useItemsMapPressure} from "../../common/pressure";
import {VsProjects默认} from "./orcBase";
import {ReportFirstPageHeadAllNmbbm} from "../../industrial/rarelyVary";
import {WaterQualityVw} from "./WaterQuality";
import {编制审核Utili} from "../../gas/utilityNj/viewRes";
import {CarrierConditionVw, TypeTestVw} from "./CarrierCondition";
import {Link as RouterLink} from "../../../routing/Link";
import {注意事项OrganH, 首页概况OrganH} from "../organicHeat/rarelyVary";

export const ReportView: React.FunctionComponent<ReportViewProps> = ({
    repId,   source: orc,  verId,rep,
}) => {
    const theme= useTheme();
    const [mapFxian]=useItemsMapPressure({ projects:orc.Projects });
    const [rootMenu]=useRepMenuDirItems(VsProjects默认, orc.Projects, `/reportView/${rep?.modeltype}/ver/${verId}/${repId}`);
   return (
    <React.Fragment>
        {rootMenu}
        <div css={{"@media not print": {marginTop: '1rem', marginBottom: '1rem'}}}>
            <div css={{
                display: 'flex',
                flexDirection: 'column',
                justifyContent: 'space-between',
                "@media print": {height: '100vh', pageBreakInside: 'avoid',}
            }}>
                {ReportFirstPageHeadAllNmbbm({theme, rep,nMa:true})}
                <div>
                    <Text variant="h3" css={{
                        textAlign: 'center',
                        "@media (min-width:690px),print and (min-width:538px)": {
                            fontSize: theme.fontSizes[6],
                        }
                    }}>
                     未使用有机热载体检验报告
                    </Text>
                    <br css={{"@media not print": {display: 'none'}}}/>
                    <Text variant="h6" css={{textAlign:'center'}}>（FJB/GK 1017-1-0-2023）</Text>
                </div>
                <div>
                    {首页概况OrganH({theme, orc, rep})}
                </div>
                <div css={{textAlign: 'center', "@media print": {pageBreakInside: 'avoid'}}}>
                    {落款单位地址}
                </div>
            </div>
            {注意事项OrganH({rep,
                comply: '是依据TSG 11-2020《锅炉安全技术规程》、GB/T 24747《有机热载体安全技术条件》，NB/T 10937-2022《锅炉水（介）质处理检验导则》，对未使用有机热载体检验的结论报告'
            })}
            <div css={{"@media print": {display: 'none'}}}>
                <br/>
                <RouterLink href={`/report/${rep?.modeltype}/ver/${verId}/${repId}/SurveySupp#SurveySupp`}>
                    <Text variant="h4">没有关联台账的情形-单位设备概况 &gt;</Text>
                </RouterLink>
            </div>
            {检验报告设备({theme, orc, rep})}
            <CarrierConditionVw orc={orc} rep={rep}/>
            <TypeTestVw orc={orc} rep={rep}/>
            <WaterQualityVw orc={orc} rep={rep}/>
            <Table id={'Conclusion'} fixed={ ["9%","%","5.5%","37%"] } css={{borderCollapse: 'collapse', }} tight  miniw={800}>
                <TableBody>
                    <RepLink rep={rep} tag={"Conclusion"}>
                        <TableRow>
                            <CCell>检验依据</CCell><Cell colSpan={3}>TSG 11-2020《锅炉安全技术规程》、GB/T 24747-2009《有机热载体安全技术条件》、
                            NB/T 10937-2022《锅炉水（介）质处理检验导则》</Cell>
                        </TableRow>
                        <TableRow>
                            <CCell>检验结论</CCell><CCell><Text variant="h1" css={{fontSize:'1.3rem'}}>{orc?.检验结论?? '／'}</Text></CCell>
                            <CCell>备注</CCell><Cell>验证合格的未使用有机热载体注入新装系统，投入运行三个月内应进行首次检验。</Cell>
                        </TableRow>
                        <TableRow>
                            <Cell colSpan={4}><div css={{minHeight: '3rem', whiteSpace: 'pre-wrap',marginLeft: '0.2rem'}}>
                                处置意见或建议：<br/>
                                {orc.结论说明 ?? '／'}
                            </div></Cell>
                        </TableRow>
                    </RepLink>
                </TableBody>
            </Table>
            {编制审核Utili({theme, orc, rep,bcap:'检验',pcap:'批准'})}
        </div>
        {末尾链接({template: rep?.modeltype, verId, repId: repId || ''})}
    </React.Fragment>
    );
}
